import Vue from 'vue'
import App from './App'
import store from './store' // Vuex Store
import plugins from './plugins' // 插件
import './permission' // 权限控制
import storage from './utils/storage'
import constant from './utils/constant'
Vue.use(plugins)

Vue.config.productionTip = false
Vue.prototype.$store = store

App.mpType = 'app'

const app = new Vue({
  store,
  ...App,
  mounted() {
    // // 获取用户ID
    // const userId = storage.get(constant.userId)
    // if (userId) {
    //   this.$store.dispatch('websocket/initWebSocket', userId);
    // }
  },
  beforeDestroy() {
    this.$store.dispatch('websocket/closeWebSocket');
  }
})

app.$mount()
